package net.luoran.dvm.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.luoran.dvm.entity.vo.PanelModuleContentVO;
import net.luoran.dvm.entity.PanelModuleDO;
import net.luoran.dvm.mapper.PanelModuleContentMapper;
import net.luoran.dvm.mapper.PanelModuleMapper;
import net.luoran.dvm.service.PanelModuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 数据大屏已保存的组件 服务实现类
 * </p>
 *
 * @author MyBatisPlusGenerater
 * @since 2020-10-29
 */
@Service
@Transactional
public class PanelModuleServiceImpl extends ServiceImpl<PanelModuleMapper, PanelModuleDO> implements PanelModuleService {


    @Autowired private PanelModuleMapper panelModuleMapper;
    @Autowired private PanelModuleContentMapper panelModuleContentMapper;

    @Override
    public void removeByModuleId(String moduleId) {
        panelModuleMapper.deleteById(moduleId);
    }

    @Override
    public void saveOrUpdatePanelModule(PanelModuleDO panelModuleDO) {
        panelModuleMapper.updateById(panelModuleDO);
    }

    @Override
    public void savePanelModule(PanelModuleDO panelModuleDO) {
        panelModuleMapper.insert(panelModuleDO);
    }

    @Override
    public Page<PanelModuleContentVO> selectPanelModuleByName(Page page, PanelModuleContentVO panelModuleContent) {
        return panelModuleContentMapper.selectPanelModuleByName(page,panelModuleContent.getPanelName());
    }
}
